import collections

class StrKeyDict(collections.UserDict): #1

    def __missing__(self, key): #2
        if isinstance(key, str):
            raise KeyError(key)
        return self[str(key)]

    def __contains__(self, key):
        return str(key) in self.data #3

    def __setitem__(self, key, value):
        self.data[str(key)] = value #4